Chris Pollett > Old Classses >
CS116a

( Print View )

Student Corner:
  [Grades Sec1]
  [Submit Sec1]
  [Class Sign Up Sec1]
  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [Class Protocols]
  [HW/Quiz Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Midterm]  [Final]

                           












HW#4 --- last modified February 07 2019 04:34:20..

Solution set.

Due date: Nov 18

Files to be submitted:
  Hw4.zip

Purpose:To gain experience with color in computer graphics. To gain experience with Bezier and other curves.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

LO1 -- Implement a curve drawing algorithm in OpenGL.

LO6 -- Write an OpenGL program that makes use of lighting and different kinds of materials.

Specification:

For the first part of your homework you have a choice: Either do problems 19.1 and 19.3 out of the book and put your answers in your submission ZIP file in the file book.txt or modify the texture portion of your code for HW1 so that hitting the G for gamma key will toggle between using an SRGB frame buffer and sRGB source texture and using RGB ones. If to compile, you have needed to set g_Gl2Compatible to true you might have problems with this coding portion.

For the rest of the assignment you will be using dominoes to explore the wonderful world of Catmull Rom splines. You should write a program which reads in a file spline.txt in your executables directory. This will consist of a sequence of lines of the form:

x1-float,z1-float
x2-float,z2-float
...

For example,

-1.,0
-0.5,0
-0.5,0.5
...

These represent positions of "control" dominoes in the x-z plane. After reading in your file, your program should draw a green ground covering the visible x-z, on which rests 4 high, 1 wide, 0.5 thick, black dominoes with white dots at the positions that were just read in. The exact dot patterns of the two numbers on the domino front face I leave up to you. The camera should be at +10 units from the origin in the z-direction, +3units in the y-direction looking at the origin. Each domino, except the first and last, again which I leave up to you, should be oriented in the direction of the vector from the position of the domino one before to the domino one after it. View the sequence of x values read in and the sequence of z values read in as Catmull Rom control points. When the user hits the i (for interpolate) key. Your program should interpolate evenly five dominoes between each control point (you might end up drawing dominoes partially over dominoes depending on the spline.txt files) using these Catmull Rom splines. The direction the interpolated dominoes are facing should be based on the first directive of the splines at that point.

That completes the description of the homework. I will award up to two bonus points if hitting the a key draws the interpolants, then starting with the first domino, topples the dominoes over as in a domino effect demonstration.

Point Breakdown

Two book problems (1pt each) or modify HW1 frame buffer (1pt) and texture (1pt) on G key press2pts
Department C++ Style Guides followed1pt
Reads in splines.txt from file1pt
Ground (1pt) and camera placement (1pt)2pts
Placement of control dominoes and of size described1pt
Orientation of control dominoes as described1pt
i key toggles showing 5 interpolant dominoes between each control domino (except for between first and second and last and last - 1)1pt
Orientations of interpolant dominoes as per first derivative1pt
Total10pts